package com.example.healthcondition.entity;

import java.time.LocalDateTime;
import java.time.LocalTime;

public class ExerciseRecords {
    private Integer record_id;
    private Integer user_id;
    private String exercise_type;
    private LocalTime duration; // 用于表示时间的字段
    private Integer calories_burned;
    private LocalDateTime recorded_at;

    // 默认构造函数
    public ExerciseRecords() {
    }

    // 带所有属性的构造函数
    public ExerciseRecords(Integer record_id, Integer user_id, String exercise_type, LocalTime duration, Integer calories_burned, LocalDateTime recorded_at) {
        this.record_id = record_id;
        this.user_id = user_id;
        this.exercise_type = exercise_type;
        this.duration = duration;
        this.calories_burned = calories_burned;
        this.recorded_at = recorded_at;
    }

    // Getter和Setter方法
    public Integer getRecordId() {
        return record_id;
    }

    public void setRecordId(Integer record_id) {
        this.record_id = record_id;
    }

    public Integer getUserId() {
        return user_id;
    }

    public void setUserId(Integer user_id) {
        this.user_id = user_id;
    }

    public String getExerciseType() {
        return exercise_type;
    }

    public void setExerciseType(String exercise_type) {
        this.exercise_type = exercise_type;
    }

    public LocalTime getDuration() {
        return duration;
    }

    public void setDuration(LocalTime duration) {
        this.duration = duration;
    }

    public Integer getCaloriesBurned() {
        return calories_burned;
    }

    public void setCaloriesBurned(Integer calories_burned) {
        this.calories_burned = calories_burned;
    }

    public LocalDateTime getRecordedAt() {
        return recorded_at;
    }

    public void setRecordedAt(LocalDateTime recorded_at) {
        this.recorded_at = recorded_at;
    }

    // toString方法
    @Override
    public String toString() {
        return "ExerciseRecords{" +
                "record_id=" + record_id +
                ", user_id=" + user_id +
                ", exercise_type='" + exercise_type + '\'' +
                ", duration=" + duration +
                ", calories_burned=" + calories_burned +
                ", recorded_at=" + recorded_at +
                '}';
    }

    // hashCode和equals方法
    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        ExerciseRecords that = (ExerciseRecords) o;
        return record_id != null && record_id.equals(that.record_id);
    }

    @Override
    public int hashCode() {
        return record_id != null ? record_id.hashCode() : 0;
    }
}